﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NUnitResults
{
    public class NotRunTestCase : TestCase
    {
        public String Reason { get; private set; }

        public NotRunTestCase(String name, String nspace, Status status, Nullable<TimeSpan> time, Nullable<Int32> asserts, String reason)
            : base(name, nspace, status, time, asserts)
        {
            if (reason == null)
            {
                throw new ArgumentNullException("reason");
            }

            Reason = reason;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode() ^ Reason.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            var other = obj as NotRunTestCase;

            if (other == null)
            {
                return false;
            }

            if (!base.Equals(other))
            {
                return false;
            }

            if (this.Reason != other.Reason)
            {
                return false;
            }

            return true;
        }

        /// <summary>
        /// Converts this test case to a string.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return String.Format("TestCase(\"{0}\", \"{1}\", \"{2}\", \"{3}\")", Name, Namespace, Status, Reason);
        }
    }
}
